/**
 * 
 */
package com.jinmei.comparator;

import java.util.Comparator;

import org.apache.commons.lang.StringUtils;

import com.jinmei.web.WorkScheduleDTO;

/**
 * @author richard
 *
 */
public class WorkScheduleDTOComparator implements Comparator<WorkScheduleDTO> {

	@Override
	public int compare(WorkScheduleDTO ws1, WorkScheduleDTO ws2) {
		if (ws1 == null || ws2 == null) return 0;
		
		String employeeId1 = ws1.getEmployeeId();
		String employeeId2 = ws2.getEmployeeId();
        
		if(!StringUtils.isEmpty(employeeId1)) {
			int cmpInt = employeeId1.compareTo(employeeId2);
			// 升序排列
			return (cmpInt == 0) ? 0 :
				(cmpInt > 0) ? 1 : -1;
		}
		return 0;
	}

}
